{template 'common/header'}

<script type="text/javascript" src="../addons/meepo_bigwall/template/jquery-1.7.2.min.js"></script>
<script>
	function selectall(obj, name){
		$('input[name="'+name+'[]"]:checkbox').each(function() {
			$(this).attr("checked", $(obj).attr('checked') ? true : false);
		});
	}
</script>

<DIV id="new">
<style>
#new a{margin-left:10px;}
</style>
  
<A class="btn btn-primary btn-sm" href="{php echo '../app/'.$this->createMobileUrl('Index',array('rid'=>$id))}" target="__blank"><i class="fa fa-edit"></i>查看上墙内容入口</A> 
<a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('manage',array('type'=>'delete','del'=>'all','id'=>$id))}" onclick="return confirm('清空所有墙内内容，将无法恢复，确认吗？');return false;"><i class="fa fa-times"></i>清空墙内内容</a>      

<a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('manage',array('type'=>'delete','del'=>'allperson','id'=>$id))}" onclick="return confirm('清空所有录入的人数，将无法恢复，确认吗？');return false;"><i class="fa fa-times"></i>清空录入的总人数</a>         

<a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('manage',array('type'=>'delete','del'=>'yyy','id'=>$id))}" onclick="return confirm('清空所有摇一摇数据，将无法恢复，确认吗？');return false;"><i class="fa fa-times"></i>重置摇一摇</a>
<a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('manage',array('type'=>'reset','del'=>'vote','id'=>$id))}" onclick="return confirm('清空所有投票票数数据，将无法恢复，确认吗？');return false;"><i class="fa fa-times"></i>重置投票数目</a></DIV><br><br>
<ul class="nav nav-tabs">
    <li {if !empty($op)} class="active"{/if}><a href="{php echo $this->createWebUrl('manage', array('id' => $id, 'op' =>'list'))}">人员列表</a></li>
	<li {if empty($op) && $_GPC['isshow'] == 0} class="active"{/if}><a href="{php echo $this->createWebUrl('manage', array('id' => $id, 'isshow' => 0))}">待审核</a></li>
	<li {if empty($op) && $_GPC['isshow'] == 1} class="active"{/if}><a href="{php echo $this->createWebUrl('manage', array('id' => $id, 'isshow' => 1))}">已审核</a></li>
</ul>
<div class="panel panel-default">

	<div class="panel-heading">筛选</div>
	<div class="panel-body">
		<form action="./index.php" method="get" class="form-horizontal" role="form">
			<input type="hidden" name="c" value="site" />
			<input type="hidden" name="a" value="entry" />
			<input type="hidden" name="m" value="meepo_newwxwall" />
			<input type="hidden" name="do" value="manage" />
            <input type="hidden" name="id" value="{$id}" />
			{if $op}
			 <input type="hidden" name="op" value="{$op}" />
			{else}
             <input type="hidden" name="isshow" value="{$isshow}" />
			 {/if}
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">粉丝昵称</label>
				<div class="col-xs-12 col-sm-8 col-lg-9">
					<input class="form-control" name="keyword" id="" type="text"  placeholder="请输入用户昵称">
				</div>
			</div>
			<div class="form-group">
				<div class=" col-xs-12 col-sm-2 col-lg-2">
					<input type="submit"  value="搜索" class="btn btn-primary" />
				</div>
			</div>

		</form>
	</div>
</div>
<div class="panel panel-warning">
	<div class="panel-heading">
		{if empty($op) && $_GPC['isshow'] == 0}待审核{/if}
		{if empty($op) && $_GPC['isshow'] == 1}已审核{/if}
		{if !empty($op)}人员列表{/if}
	</div>
	{if empty($op)}
	<div class="panel-body">
		<div class="main" id="table-list">
			<form action="" method="post" onsubmit="">
				<div class="table-responsive">
					<table class="table table-hover">
						<thead class="navbar-inner">
						<tr>
						    
							<th style="width:10%;" class="row-first">选择</th>
							<th style="width:30%;">用户<i></i></th>
							<th class="row-hover" style="width:20%">消息<i></i></th>
							<th style="width:20%;">时间<i></i></th>
							<th style="width:20%;">操作</th>
						</tr>
						</thead>
						<tbody>
						{loop $list $row}
						<tr>
							<td class="row-first"><input type="checkbox" name="select[]" value="{$row['id']}" /></td>
							<td class="row-hover">
								<img width="50" src="{$row[avatar]}" class="avatar" />
								<div class="mainContent">
									<div class="nickname">{$row[nickname]}{if $row[isblacklist]}<span class="label label-danger">(黑名单)</span>{/if}</div>
								</div>
							</td>
							<td>{$row[content]}</td>
							<td style="font-size:12px; color:#666;">
								<div style="margin-bottom:10px;">{php echo date('Y-m-d', $row[createtime]);}</div>
								<div>{php echo date('H:i:s', $row[createtime]);}</div>
							</td>
							<td>
								{if $row['isblacklist']==0}
								<a class="btn btn-primary" href="{php echo $this->createWebUrl('blacklist', array('id' => $id, 'isshow'=>$isshow, 'openid' => $row[openid], 'switch' => 1))}">添加黑名单</a>
								{else}
								<a class="btn btn-danger" href="{php echo $this->createWebUrl('blacklist', array('id' => $id, 'isshow'=>$isshow, 'openid' => $row[openid], 'switch' =>0))}">移除黑名单</a>
								{/if}
								
								
							</td>
						</tr>
						{/loop}
						</tbody>
					</table>
					{if !empty($list)}
					<table class="table">
						<tr>
							<td style="width:50px;" class="row-first"><input type="checkbox" onclick="selectall(this, 'select');" /></td>
							<td colspan="4">
								{if $_GPC['isshow'] == 0}
								<input type="submit" name="verify" value="审核" class="btn btn-primary" />
								{/if}
								<input type="submit" name="delete" value="删除" class="btn btn-primary" />
								<input type="hidden" name="token" value="{$_W['token']}" />
							</td>
						</tr>
					</table>
					{/if}
					{$pager}
				</div>
			</form>
		</div>
	</div>
</div>
{else}
<div class="panel-body">
		<div class="main" id="table-list">
			<form action="" method="post" onsubmit="">
				<div class="table-responsive">
					<table class="table table-hover">
						<thead class="navbar-inner">
						<tr>
						    <th style="width:25px;">选？</th>
							<th>ID</th>
							<th >用户<i></i></th>
							<th >性别</th>
							<th class="row-hover" >发送消息<i></i></th>
							<th >是否签到<i></i></th>
							<th >内定情况<i></i></th>
							<th>
							 
							</th>
						</tr>
						</thead>
						<tbody>
						{loop $list $row}
						<tr>
						<td><input type="checkbox" name="messageid[]" value="{$row['id']}" class=""></td>
							<td>{$row['id']}</td>
							<td class="row-hover">
								<img width="50" src="{$_W['attachurl']}{$row[avatar]}" class="avatar" />
								<div class="mainContent">
									<div class="nickname">{$row['nickname']}</div>
								</div>
							</td>
							<td>{if $row['sex'] == '1'}男{elseif $row['sex'] == '2'}女{else}未知{/if}</td>
							<td>
								{$row['num']}条
							</td>
							<td>
								{if $row['sign']==1}
								   已签到
								{else}
								   未签到
								{/if}
								
								
							</td>
							<td style="color:red">{$row['cj']}</td>
							<td>
							{if $row['isblacklist']==0}
								<a class="btn btn-primary" href="{php echo $this->createWebUrl('blacklist', array('id' => $id, 'isshow'=>1, 'openid' => $row[openid], 'switch' => 1,'op'=>'list'))}">添加黑名单</a>
								{else}
								<a class="btn btn-danger" href="{php echo $this->createWebUrl('blacklist', array('id' => $id, 'isshow'=>0, 'openid' => $row[openid], 'switch' =>0,'op'=>'list'))}">移除黑名单</a>
								{/if}
							</td>
						</tr>
						{/loop}
						<tr>
						<td><input type="checkbox" onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});"></td>
				        <td>
						<input name="token" type="hidden" value="{$_W['token']}" />
						<input type="submit" class="btn btn-success" name="download" value="导出所有数据" />
                         
                       </td>
					  
				       </tr>
						</tbody>
					</table>
					
					{$pager}
				</div>
			</form>
		</div>
	</div>
</div>
{/if}
<script>
require(['jquery'], function($){
	//详细数据相关操作
	var tdIndex;
	$("#table-list thead").delegate("th", "mouseover", function(){
		if($(this).find("i").hasClass("")) {
			$("#table-list thead th").each(function() {
				if($(this).find("i").hasClass("icon-sort")) $(this).find("i").attr("class", "");
			});
			$("#table-list thead th").eq($(this).index()).find("i").addClass("icon-sort");
		}
	});
	$("#table-list thead th").click(function() {
		if($(this).find("i").length>0) {
			var a = $(this).find("i");
			if(a.hasClass("icon-sort") || a.hasClass("icon-caret-up")) { //递减排序
				/*
					数据处理代码位置
				*/
				$("#table-list thead th i").attr("class", "");
				a.addClass("icon-caret-down");
			} else if(a.hasClass("icon-caret-down")) { //递增排序
				/*
					数据处理代码位置
				*/
				$("#table-list thead th i").attr("class", "");
				a.addClass("icon-caret-up");
			}
			$("#table-list thead th,#table-list tbody:eq(0) td").removeClass("row-hover");
			$(this).addClass("row-hover");
			tdIndex = $(this).index();
			$("#table-list tbody:eq(0) tr").each(function() {
				$(this).find("td").eq(tdIndex).addClass("row-hover");
			});
		}
	});
});
</script>

{template 'common/footer'}
